
Summary:	A printer administration tool
Name:		system-config-printer
Version:	1.5.18
Release:	1.mos1
License:	LGPLv2+
Group:		System/Configuration/Printing
Url:		https://github.com/OpenPrinting/system-config-printer/
Source0:	https://github.com/OpenPrinting/system-config-printer/releases/download/v%{version}/%{name}-%{version}.tar.xz
Source100:	%{name}.rpmlintrc

# all upstream patches, remove with new release
Patch0001:	0001-Fix-debugprint-in-options.py-fixes-291.patch
Patch0002:	system-config-printer-gettext.patch
# MOS patch - add link to wiki
Patch0100:  link-to-wiki-in-new-printer-window.patch

BuildRequires:	gettext-devel
BuildRequires:	intltool
BuildRequires:	xmlto-notex
BuildRequires:	pkgconfig(dbus-1)
BuildRequires:	pkgconfig(dbus-glib-1)
BuildRequires:	cups-devel
BuildRequires:	pkgconfig(libudev)
BuildRequires:	pkgconfig(libusb)
BuildRequires:	pkgconfig(python3)
BuildRequires:	pkgconfig(glib-2.0)

Requires:	packagekit
# devel package is needed for install-printerdriver
# Requires:	packagekit-devel
# not it's DON'T
# requires only typelib and NEVER fetch devel packages to non-devel distro
Requires:   typelib(PackageKitGlib)
# end
Requires:	acl
Requires:	dbus-x11
Requires:	desktop-file-utils
Requires:	gnome-icon-theme
Requires:	hplip-model-data

Requires:	python3-libxml2
Requires:	python3-cups
Requires:	python3-curl
Requires:	python3-dbus
Requires:	python3-gi
Requires:	python3-gobject
Requires:	python3-pyinotify
Requires:	python3-smbc
Requires:	python3-requests
Requires:	python3-cairo

Requires:	system-config-printer-common = %{EVRD}
Requires:	system-config-printer-udev = %{EVRD}
Requires:	virtual-notification-daemon
#For non GTK3 system
Requires:	canberra-gtk
# typelib() deps are generated auytomatically by generator
# from gobject-introcpection, actually they can be removed here
Requires:	typelib(Atk)
Requires:	typelib(GdkPixbuf)
Requires:	typelib(Gio)
Requires:	typelib(Gtk) = 3.0
Requires:	typelib(Polkit)
Requires:	typelib(Pango)
Requires:	typelib(Notify)
Recommends:	samba-client
# code gently handles missing cups-pk-helper,
# if it is available - polkit is used,
# otherwise CUPS authentication is used
Recommends:	(cups-pk-helper if polkit)

%description
system-config-printer is a graphical user interface that allows
the user to configure a CUPS print server.

%files
%doc ChangeLog README
%{_bindir}/scp-dbus-service
%{_bindir}/%{name}
%{_bindir}/%{name}-applet
%{_bindir}/install-printerdriver
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/ui
%dir %{_datadir}/%{name}/xml
%{_datadir}/%{name}/__pycache__
%{_datadir}/%{name}/*.py*
%{_datadir}/%{name}/troubleshoot
%{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/xml/*
%{_datadir}/%{name}/icons
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/%{name}.appdata.xml
#{_datadir}/appdata/#{name}.appdata.xml
%{_sysconfdir}/xdg/autostart/print-applet.desktop
%{_mandir}/man1/*

#----------------------------------------------------------------------------

%package udev
Summary:	Rules for udev for automatic configuration of USB printers
Group:		System/Configuration/Hardware
Requires:	system-config-printer-common = %{EVRD}
Requires:	udev

%description udev
The udev rules and helper programs for automatically configuring USB
printers.

%files udev
/lib/udev/udev-add-printer
/lib/udev/udev-configure-printer
%{_udevrulesdir}/70-printers.rules
%{_unitdir}/configure-printer@.service

#----------------------------------------------------------------------------

%package  common
Summary:	Common code for the graphical and non-graphical pieces
Group:		System/Libraries
Requires:	foomatic
Requires:	python3
Requires:	python3-cups
# files were moved here, subpackage libs was removed
Conflicts:	system-config-printer-libs < 1.5.15
Obsoletes:	system-config-printer-libs < 1.5.15

%description common
The common code used by both the graphical and non-graphical parts of
the configuration tool.

%files common -f system-config-printer.lang
%dir %{_sysconfdir}/cupshelpers/
%config(noreplace) %{_sysconfdir}/cupshelpers/preferreddrivers.xml
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.redhat.NewPrinterNotification.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.redhat.PrinterDriversInstaller.conf
%config(noreplace) %{_datadir}/dbus-1/interfaces/org.fedoraproject.Config.Printing.xml
%config(noreplace) %{_datadir}/dbus-1/services/org.fedoraproject.Config.Printing.service
%dir %{python3_sitelib}/cupshelpers
#{python3_sitelib}/__pycache__
%{python3_sitelib}/cupshelpers/__pycache__
%{python3_sitelib}/cupshelpers/__init__.py*
%{python3_sitelib}/cupshelpers/cupshelpers.py*
%{python3_sitelib}/cupshelpers/openprinting.py*
%{python3_sitelib}/cupshelpers/ppds.py*
%{python3_sitelib}/cupshelpers/config.py*
%{python3_sitelib}/cupshelpers/installdriver.py*
%{python3_sitelib}/cupshelpers/xmldriverprefs.py*
%{python3_sitelib}/*.egg-info

#----------------------------------------------------------------------------

%prep
%autosetup -p1

%build
# find serverbin-dir from cups-config --serverbin
%configure \
	--prefix=%{_prefix} \
	--with-systemdsystemunitdir=%{_unitdir} \
	--with-udev-rules \
	--with-polkit-1 \
	--with-cups-serverbin-dir=%{_prefix}/lib/cups

%make

%install

# to hide rpm build error about empty file
echo "See man(1) %{name}, %{name}-applet" >> ./README

%makeinstall_std udevrulesdir=%{_udevrulesdir}  udevhelperdir=/lib/udev

%py3_compile %{buildroot}

%find_lang system-config-printer
